package com.zombie.logic.object.ai;

import com.zombie.logic.object.LiveObject;
import com.zombie.logic.object.ai.action.Action;
import com.zombie.logic.object.ai.action.ActionFollow;
import com.zombie.logic.object.ai.action.ActionType;

public class FriendAI extends FleeAI {

	public LiveObject friend;
	
	public FriendAI(LiveObject owner) {
		super(owner);
	}
	
	@Override
	public void actionDone(Action action) {
		if (action.type != ActionType.FOLLOW){
			if (friend.position.dst(owner.position) > 100)
				setAction(new ActionFollow(friend));
		} else
			super.actionDone(action);
	}

	
	@Override
	public void spawned() {
		setAction(new ActionFollow(friend));
	}
}
